package com.yaowk.common.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;
import com.jfinal.kit.StrKit;

/**
 * @authc yaowk
 * 2017/5/1
 */
public class FormDataInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation inv) {
        Controller c = inv.getController();
        String header = c.getHeader("content-type");
        if (StrKit.notBlank(header) && header.startsWith("multipart/form-data")) {
            c.getFile();
        }
        inv.invoke();
    }
}
